﻿

namespace Mulala.Cavan.Domain.MainBoundedContext.ProprietorModule
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using FluentValidation;
    using Mulala.Cavan.Domain.MainBoundedContext.Resources;
    using Mulala.Cavan.Core.Helper;

    public class ProprietorValidator : AbstractValidator<Proprietor>
    {
        public ProprietorValidator()
        {
            RuleFor(p => p.Name).NotEmpty().Length(2, 10).WithMessage(Messages.Validate_ProprietorNameIsInvalid);
            RuleFor(p => p.ContactEmail).EmailAddress().WithMessage(Messages.Validate_EmailIsInvalid);
            RuleFor(p => p.Telephone).Matches(StringHelper.TELEPHONEREGULAR).WithMessage(Messages.Validate_TelephoneIsInvalid);
            RuleFor(p => p.Address).Length(2, 200).WithMessage(Messages.Validate_ProprietorAddressIsInvalid); ;
        }
    }
}
